import requests
from requests.exceptions import ReadTimeout, HTTPError, RequestException
for a in range(0, 50):
  try:
      response = requests.get('https://www.whatismyip.com', timeout=0.5)
      print(a, response.status_code)
  # except Exception as e:
  #     print('异常'+str(e))
  except ReadTimeout:
        print('timeout')
  except HTTPError:
      print('httperror')
  except RequestException:
      print('request error')
               